package com.example.administrator.u17.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;

import java.util.List;

/**
 * Created by Administrator on 2016/11/15.
 */

public class MineFragmentAdapter extends FragmentPagerAdapter {

    private List<Fragment> mList;

    private String[] titles;

    public MineFragmentAdapter(FragmentManager fm,List<Fragment> mList,String[] titles) {
        super(fm);
        this.titles=titles;
        this.mList=mList;
    }


    @Override
    public int getCount() {
        return mList==null?0:mList.size();
    }

    @Override
    public Fragment getItem(int position) {
        return mList.get(position);
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view==object;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
